package com.blog.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blog.pojo.Blog;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Copyright (C), 2022
 * Author: 苏大大
 * Date: 2022-04-21 16:45
 * FileName: BlogMapper
 * Description: 博客数据层
 */
@Repository(value ="BlogMapper")
@Mapper
public interface BlogMapper extends BaseMapper<Blog> {

   /***
    * 搜索&分类-查询
    * @param type_id
    * @param title
    * @return
    */
   List<Blog> queryByTypeAll(Integer type_id, String title);

   /***
    * 标签查询
    * @param tag_id
    * @return
    */
   List<Blog> queryByTagAll(Integer tag_id);

   /***
    * 查询首页推荐博客
    * @return
    */
   List<Blog> queryRecommendBlog();

   /***
    * 根据博客id查询博客信息
    * @param blogId
    * @return
    */
   Blog queryByIdBlog(Long blogId);

   /***
    * 根据用户Id查询发布的博客
    * @param uid
    * @return
    */
   List<Blog> queryByuIdBlog(Long uid,String title);

   /***
    * 根据博客Id修改博客信息
    * @param blog
    * @return
    */
   int UpdateBlog(Blog blog);

   /***
    * 发布博客
    * @param blog
    * @return
    */
   int PublishBlog(Blog blog);
}
